
#pragma once

#include <stdio.h>
#include <errno.h>

#ifdef WIN32
#ifndef _WIN32_WINNT
//#define _WIN32_WINNT 0x0400
#endif

#include <windows.h>
#include <winsock.h>

struct iovec {
    u_long  iov_len; // this is not the POSIX definition, it is rather defined to be
    char FAR*   iov_base; // equivalent to a WSABUF for easy integration into Win32
};
#define _64BITARG_ "I64"

#ifdef __Win32__
#define kPathDelimiterChar		'\\'
#else
#define kPathDelimiterChar		'/'
#endif

typedef unsigned char       UInt8;
typedef signed char         SInt8;
typedef unsigned short      UInt16;
typedef signed short        SInt16;
typedef unsigned long       UInt32;
typedef signed long         SInt32;
typedef LONGLONG            SInt64;
typedef ULONGLONG           UInt64;
typedef float               Float32;
typedef double              Float64;
typedef UInt16              Bool16;
typedef UInt8               Bool8;

#define SNPRINTF   _snprintf
#define SNWPRINTF   _snwprintf
#else
#define kPathDelimiterChar '/'
#define _64BITARG_ "q"

typedef unsigned char       UCHAR;
typedef unsigned char       UInt8;
typedef signed char         SInt8;
typedef unsigned short      UInt16;
typedef signed short        SInt16;

//typedef unsigned long       UInt32;
typedef unsigned int       UInt32;   //modified by w.zhong, 2016-9-17 10:17:15
                                     //typedef signed long         SInt32;  //sizeof(long)==8 in x64
typedef signed int          SInt32; //modified by w.zhong, 2016-9-17 10:17:15
typedef signed long long    SInt64;
typedef unsigned long long  UInt64;
typedef float               Float32;
typedef double              Float64;
typedef UInt16              Bool16;
typedef UInt8               Bool8;

#define SNPRINTF   snprintf
#define SNWPRINTF   snwprintf

#endif

#include "ErrCode.h"

#define kAssertBuffSize 256
#define AssertV(condition,errNo)    {                                   \
    if (!(condition))                                                   \
    {                                                                   \
        printf( "_AssertV: %s, %d (%d)",__FILE__, __LINE__, errNo );    \
    }}
